﻿/*
This project and all of its code is/are Copyright (C) 2017  Nils Hunter Alving

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;

namespace DynamicTypeBuilder.ConstrainedType.Examples
{
    /// <summary>
    /// An example class for testing the indexing functionality of the base class
    /// </summary>
    public class OneThruFive : ConstrainedTypeBase<int>
    {
        public const int One = 1;
        public const int Two = 2;
        public const int Three = 3;
        public const int Four = 4;
        public const int Five = 5;

        private static Dictionary<int,int?> PossibleValues = new Dictionary<int, int?>()
        {
            {One, null },
            {Two, null },
            {Three, null },
            {Four, null },
            {Five, null }
        };

        public OneThruFive() : base(PossibleValues)
        {
        }

        public static implicit operator OneThruFive(int digit)
        {
            return new OneThruFive() { Value = digit };
        }
    }
}
